import 'package:pigeon/pigeon.dart';

// 输出配置
// 控制台执行：dart run pigeon --input lib/config/pigeons/pigeon_message.dart
@ConfigurePigeon(PigeonOptions(
  dartOut: 'lib/generated/pigeons/pigeon_message.g.dart',
  dartOptions: DartOptions(),
  kotlinOut: 'android/app/src/main/kotlin/com/ashlikun/flutter_base_app/generated/pigeons/PigeonMessages.g.kt',
  kotlinOptions: KotlinOptions(),
  swiftOut: 'ios/Runner/generated/pigeons/PigeonMessages.g.swift',
  swiftOptions: SwiftOptions(),
  // objcHeaderOut: 'macos/Runner/generated/pigeons/PigeonMessages.g.h',
  // objcSourceOut: 'macos/Runner/generated/pigeons/PigeonMessages.g.m',
  // Set this to a unique prefix for your plugin or application, per Objective-C naming conventions.
  // objcOptions: ObjcOptions(prefix: 'PGN'),
  // copyrightHeader: 'pigeons/copyright.txt',
  // dartPackageName: 'pigeon_example_package',
))
class CommonParams {
  CommonParams({required this.code, required this.data});

  int code;
  String? message;
  Map<String, Object?> data;
}

//Flutter 调用 原生
@HostApi()
abstract class MessageHostApi {
  //公共通用方法
  CommonParams call(CommonParams params);

  //获取app渠道
  String getAppFlavor();
  // @async
  // bool sendMessage(CommonParams params);
}

//原生调用Flutter方法
@FlutterApi()
abstract class MessageFlutterApi {
  //公共通用方法
  CommonParams call(CommonParams params);
}
